package com.zxkj.login.repository.activity;


import androidx.lifecycle.LifecycleOwner;

import com.allen.library.interceptor.Transformer;
import com.allen.library.observer.CommonObserver;
import com.czy.basecommon.utils.base.BaseRepository;
import com.czy.basecommon.utils.base.StateLiveData;
import com.czy.basecommon.utils.tools.ActivityTool;
import com.zxkj.login.net.RadomApiHelper;
import com.zxkj.login.net.ResponseLogin;

import java.util.HashMap;

public class LoginRepository extends BaseRepository {
    public LoginRepository() {

    }

    public void login(MyBaseDataCallBack mDataCallBack){

        HashMap<String,Object> map=new HashMap<String, Object>();
        map.put("LoginId","useer");
        map.put("password","123");
        map.put("Lang", "0");

        RadomApiHelper.geRadomApi()
                .Login(map,0)
                .compose(Transformer.<ResponseLogin>switchSchedulers())
                .subscribe(new CommonObserver<ResponseLogin>() {


                    @Override
                    protected void onError(String errorMsg) {

                        mDataCallBack.onDataFailCallBack(300,errorMsg);
                    }

                    @Override
                    protected void onSuccess(ResponseLogin responseLogin) {
                        mDataCallBack.onDataSuccessCallBack(responseLogin);
                    }
                });


    }
}
